#+TITLE: Org mode before save hook align heading tags
#+AUTHOR: Zelphir Kaltstahl
#+STARTUP: content
#+STARTUP: indent
#+STARTUP: align
#+STARTUP: inlineimages
#+STARTUP: hideblocks
#+STARTUP: entitiesplain
#+STARTUP: nologdone
#+STARTUP: nologreschedule
#+STARTUP: nologredeadline
#+STARTUP: nologrefile
#+TODO: TODO INPROGRESS | DONE CANCELLED
#+DATE: [2023-01-31 Di]
#+LANGUAGE: English
#+PRIORITIES: A E E
#+KEYWORDS: config tags heading save hook


* Configuration

#+begin_src elisp
(add-hook 'org-mode-hook
          (function
           (lambda ()
             (add-hook 'before-save-hook
                       (lambda ()
                         ;; Not sure if this check is required.
                         (when (eq major-mode 'org-mode)
                           ;; `t' is for aligning all tags, instead of
                           ;; only the ones of the current heading.
                           (org-align-tags t)))
                       nil
                       'local))))
#+end_src
